//http://acm.hust.edu.cn/thx/problem.php?id=1041
//Solve by sort.
/*
 * Election Time
 *
 * The cows are having their first election after overthrowing the
 * tyrannical Farmer John, and Bessie is one of N cows (1 <= N <=
 * 50,000) running for President. Before the election actually happens,
 * however, Bessie wants to determine who has the best chance of
 * winning.
 *
 * The election consists of two rounds. In the first round, the K cows
 * (1 <= K <= N) cows with the most votes advance to the second round.
 * In the second round, the cow with the most votes becomes President.
 *
 * Given that cow i expects to get A_i votes (1 <= A_i <= 1,000,000,000)
 * in the first round and B_i votes (1 <= B_i <= 1,000,000,000) in the
 * second round (if he or she makes it), determine which cow is expected
 * to win the election. Happily for you, no vote count appears twice
 * in the A_i list; likewise, no vote count appears twice in the B_i
 * list.
 *
 * Input
 * * Line 1: Two space-separated integers: N and K
 *
 * * Lines 2..N+1: Line i+1 contains two space-separated integers: A_i
 * and B_i
 *
 * Output
 * * Line 1: The index of the cow that is expected to win the election.
 *
 * Sample Input
 *
 * 5 3
 * 3 10
 * 9 2
 * 5 6
 * 8 4
 * 6 5
 *
 * Sample Output
 *
 * 5
 *
 */
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int n, k;
vector<pair<int, pair<int,int> > >list;

bool cmp(pair<int,pair<int,int> >a, pair<int, pair<int,int> >b)
{
   return a.second.first > b.second.first;
}
bool cmp1( pair<int, pair<int,int> >a, pair<int, pair<int, int> >b)
{
   return a.second.second > b.second.second;
}
int init()
{
	int x,y;
	if(EOF==scanf("%d%d",&n,&k))
		return 0;
	list.clear();
	for(int i = 1; i <= n; i++){
		scanf("%d%d",&x,&y);
		list.push_back(make_pair(i,make_pair(x,y)));
	}
	return 1;
}
void solve()
{
	sort(list.begin(),list.end(),cmp);
	//sort(&list[0],&list[k],cmp1);
	vector<pair<int, pair<int,int> > >::iterator index;
	if( k >= n)index = list.end();
	else{
		index = list.begin();
		while(k){
			k--;
			index++;
		}
	}
	sort(list.begin(),index,cmp1);
	printf("%d\n",list[0].first);
}

int main(int argc, int *argv[])
{	
	init();
 	solve();
	return 0;	
}//:/~

